const { saveScore } = require("./WeChat");

var o = require("WeChat"),
    i = {
        k: 0,
        length: 0,
        titleArray: [],
        imageUrlArray: []
    };
module.exports = {
    gameName: "Star",
    gameAppid: "小游戏APPID",
    secret: "b0232e8696c32a935df8fa36ff1b780c",
    init: function () {
        console.log("初始化接口");
        o.init({
            gameName: this.gameName,
            gameAppid: this.gameAppid,
            secret: this.secret
        });
    },
    hitBox: function (t) {
        o.hitBox(t);
    },
    login: function (t) {
        o.login(t);
    },
    initShareProperties: function (t, e) {
        i.k = 0, i.length = t.length, i.titleArray = t, i.imageUrlArray = e;
    },
    getSharePropertie: function () {
        var t = {
            title: i.titleArray[i.k],
            imageUrl: i.imageUrlArray[i.k]
        };
        return i.k++, i.k = i.k % i.length, t;
    },
    openShare: function () {
        o.openShare(i.titleArray, i.imageUrlArray);
    },
    share: function (t) {
        var e = this.getSharePropertie();
        t = Object.assign({
            utc: -1,
            type: -1
        }, t), console.log("2. share res:", t), o.share({
            title: e.title,
            imageUrl: e.imageUrl,
            utc: t.utc || -1,
            type: t.type || -1
        });
    },
    onShow: function (t) {
        o.onShow(t);
    },
    shareOnClose: function () {},
    preloadBannerAD: function () {
        o.preloadBannerAD("adunit-86fa32d8dbf178ee");
    },
    updateBannerAD: function () {
        o.updateBannerAD("adunit-86fa32d8dbf178ee");
    },
    setBannerADminWidth: function () {
        o.setBannerADminWidth();
    },
    setBannerADSameMaxHeight: function () {
        o.setBannerADSameMaxHeight();
    },
    setBannerADNormalWidth: function () {
        o.setBannerADNormalWidth();
    },
    showBannerAD: function () {
        console.log("显示 banner"), this.isShowBannerAD = !0, o.showBannerAD();
    },
    hideBannerAD: function () {
        console.log("隐藏 banner"), this.isShowBannerAD = !1, o.hideBannerAD();
    },
    preloadRewardedAD: function () {
        o.preloadRewardedAD("adunit-b6591fbd280bd5d9");
    },
    showRewardedAD: function (t) {
        o.showRewardedAD(t);
    },
    closeRewardedAD: function () {
        o.closeRewardedAD();
    },
    isOkVideo: function () {
        return o.isOkVideo();
    },
    isSupportOpenData: function () {
        return o.isSupportOpenData();
    },
    initUserAuthorization: function() {
        return o.initUserAuthorization();
    },
    closeRank: function () {
        console.log("close rank");
        o.closeRank();
    },
    openRank: function () {
        o.openRank();
    },
    saveScore: function(score){
        o.saveScore("score",score);
    },
    submitScore: function (t) {
        o.submitScore(t);
    },
    gameOverRank: function () {
        o.gameOverRank();
    },
    groupFriendRank: function () {
        var t = this.getSharePropertie();
        o.groupFriendRank(t.title, t.imageUrl);
    },
    initMoreGame: function () {
        o.initMoreGame();
    },
    openMiniGame: function (t) {
        o.openMiniGame(t);
    },
    openMiniProgram: function () {
        o.openMiniProgram("小游戏APPID");
    },
    getPlatform: function (t) {
        o.getPlatform(t);
    }
}